import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const router = new Router({
  // mode: 'history',  //去掉url中的#
  routes: [{
    path: '/',
    name: 'home',
    component: () => import('@/view/home'),
    meta: { title: '智慧总仓' },
    icon: 'el-icon-s-home'
  },
  {
    path: '/demo',
    name: 'demo',
    component: () => import('@/view/demo/demo'),
    meta: { title: '示例' },
    icon: 'el-icon-view'
  },
  {
    path: '/instorage',
    name: 'instorage',
    component: {render: (e) => e('router-view')}, // 注意***没有父组件可以这么写
    meta: { title: '入库管理' },
    icon: 'el-icon-bottom',
    children: [
      {
        path: '/instorage/fzml',
        name: 'fzml',
        component: () => import('@/view/instorage/fzml'),
        meta: { title: '服装面料' }
      },
      {
        path: '/instorage/fzfl',
        name: 'fzfl',
        component: () => import('@/view/instorage/fzfl'),
        meta: { title: '服装辅料' }
      },
      {
        path: '/instorage/fzcp',
        name: 'fzcp',
        component: () => import('@/view/instorage/fzcp'),
        meta: { title: '服装裁片' }
      },
      {
        path: '/instorage/dzzl',
        name: 'dzzl',
        component: () => import('@/view/instorage/dzzl'),
        meta: { title: '电子主料' }
      },
      {
        path: '/instorage/dzfl',
        name: 'dzfl',
        component: () => import('@/view/instorage/dzfl'),
        meta: { title: '电子辅料' }
      }
    ]
  },
  {
    path: '/tailoring',
    name: 'tailoring',
    component: {render: (e) => e('router-view')},
    meta: { title: '服装裁剪管理' },
    icon: 'el-icon-scissors',
    children: [
      {
        path: '/tailoring/index',
        name: 'process',
        component: () => import('@/view/tailoring/index'),
        meta: { title: '服装裁剪终端' }
      },
      {
        path: '/tailoring/process',
        name: 'process',
        component: () => import('@/view/tailoring/process'),
        meta: { title: '服装裁剪流程' }
      }
    ]
  },
  {
    path: '/outsource',
    name: 'outsource',
    component: {render: (e) => e('router-view')},
    meta: { title: '外协片管理' },
    icon: 'el-icon-position',
    children: [
      {
        path: '/outsource/outstorage',
        name: 'outstorage',
        component: () => import('@/view/outsource/outstorage'),
        meta: { title: '外协片出库' }
      },
      {
        path: '/outsource/restorage',
        name: 'restorage',
        component: () => import('@/view/outsource/restorage'),
        meta: { title: '外协片退库' }
      }
    ]
  },
  {
    path: '/materiel',
    name: 'materiel',
    component: {render: (e) => e('router-view')},
    meta: { title: '料管管理' },
    icon: 'el-icon-shopping-cart-full',
    children: [
      {
        path: '/materiel/onShelf',
        name: 'onShelf',
        component: () => import('@/view/materiel/onShelf'),
        meta: { title: '上架管理' }
      },
      {
        path: '/materiel/offShelf',
        name: 'offShelf',
        component: () => import('@/view/materiel/offShelf'),
        meta: { title: '下架管理' }
      }
    ]
  },
  {
    path: '/kcSearch',
    name: 'kcSearch',
    component: {render: (e) => e('router-view')},
    meta: { title: '库存查询' },
    icon: 'el-icon-school',
    children: [
      {
        path: '/kcSearch/stock',
        name: 'stock',
        component: () => import('@/view/kcSearch/stock'),
        meta: { title: '库存查询' }
      }
    ]
  },
  {
    path: '/lsSearch',
    name: 'lsSearch',
    component: {render: (e) => e('router-view')},
    meta: { title: '流水查询' },
    icon: 'el-icon-notebook-2',
    children: [
      {
        path: '/lsSearch/shelves',
        name: 'shelves',
        component: () => import('@/view/lsSearch/shelves'),
        meta: { title: '上架下架流水查询' }
      },
      {
        path: '/lsSearch/location',
        name: 'location',
        component: () => import('@/view/lsSearch/location'),
        meta: { title: '入库流水查询' }
      },
      {
        path: '/lsSearch/distribution',
        name: 'distribution',
        component: () => import('@/view/lsSearch/distribution'),
        meta: { title: '配送流水查询' }
      },
      {
        path: '/lsSearch/delivery',
        name: 'delivery',
        component: () => import('@/view/lsSearch/delivery'),
        meta: { title: '发货流水查询' }
      },
      {
        path: '/lsSearch/order',
        name: 'order',
        component: () => import('@/view/lsSearch/order'),
        meta: { title: '订单物流流水查询' }
      }
    ]
  },
  {
    path: '/djSearch/bill',
    name: 'djSearch',
    component: {render: (e) => e('router-view')},
    meta: { title: '业务单据' },
    icon: 'el-icon-notebook-1',
    children: [
      {
        path: '/djSearch/bill',
        name: 'bill',
        component: () => import('@/view/djSearch/bill'),
        meta: { title: '流水查询' }
      }
    ]
  },
  {
    path: '/tool',
    name: 'tool',
    component: {render: (e) => e('router-view')},
    meta: { title: '实用工具' },
    icon: 'el-icon-s-tools',
    children: [
      {
        path: '/tool/calc',
        name: 'calc',
        component: () => import('@/view/tool/calc'),
        meta: { title: '点料' }
      },
      {
        path: '/tool/validity',
        name: 'validity',
        component: () => import('@/view/tool/validity'),
        meta: { title: '校称' }
      },
      {
        path: '/tool/calcTrans',
        name: 'calcTrans',
        component: () => import('@/view/tool/calcTrans'),
        meta: { title: '重量长度计算' }
      },
      {
        path: '/tool/storage',
        name: 'storage',
        component: () => import('@/view/tool/storage'),
        meta: { title: '库位打印' }
      },
      {
        path: '/tool/stacker',
        name: 'stacker',
        component: () => import('@/view/tool/stacker'),
        meta: { title: '垛架打印' }
      }
    ]
  },
  {
    path: '/sreen',
    name: 'sreen',
    component: {render: (e) => e('router-view')},
    meta: { title: '监区屏' },
    icon: 'el-icon-s-platform',
    children: [
      {
        path: '/sreen/guide',
        name: 'guide',
        component: () => import('@/view/sreen/guide'),
        meta: { title: '指引屏幕' }
      },
      {
        path: '/sreen/locationSreen',
        name: 'locationSreen',
        component: () => import('@/view/sreen/locationSreen'),
        meta: { title: '库位屏' }
      }
    ]
  },
  {
    path: '/lcheck',
    name: 'lcheck',
    component: {render: (e) => e('router-view')},
    meta: { title: '监区业务管理' },
    icon: 'el-icon-document-checked',
    children: [
      {
        path: '/prison/index',
        name: 'prisonindex',
        component: () => import('@/view/prison/index'),
        meta: { title: '监区业务终端' }
      }, {
        path: '/lcheck/lkcheck',
        name: 'lkcheck',
        component: () => import('@/view/lcheck/lkcheck'),
        meta: { title: '料框核对' }
      },
      {
        path: '/lcheck/qlcheck',
        name: 'qlcheck',
        component: () => import('@/view/lcheck/qlcheck'),
        meta: { title: '齐料核对' }
      },
      {
        path: '/lcheck/productpick',
        name: 'productpick',
        component: () => import('@/view/lcheck/productpick'),
        meta: { title: '生产领料' }
      },
      {
        path: '/lcheck/productreturn',
        name: 'productreturn',
        component: () => import('@/view/lcheck/productreturn'),
        meta: { title: '生产退料' }
      },
      {
        path: '/lcheck/productfinished',
        name: 'productfinished',
        component: () => import('@/view/lcheck/productfinished'),
        meta: { title: '成品入库' }
      },
      {
        path: '/lcheck/incomeweight',
        name: 'incomeweight',
        component: () => import('@/view/lcheck/incomeweight'),
        meta: { title: '来料验重' }
      },
      {
        path: '/lcheck/proorder',
        name: 'proorder',
        component: () => import('@/view/lcheck/proorder'),
        meta: { title: '生产叫料单' }
      }
    ]
  },
  {
    path: '/lackmaterial',
    name: 'lackmaterial',
    component: {render: (e) => e('router-view')},
    meta: { title: '缺料提醒' },
    icon: 'el-icon-document-checked',
    children: [
      {
        path: '/lackmaterial/index',
        name: 'lackmaterialindex',
        component: () => import('@/view/lackmaterial/index'),
        meta: { title: '缺料提醒' }
      }
    ]
  },
  {
    path: '/bagscut',
    name: 'bagscut',
    component: {render: (e) => e('router-view')},
    meta: { title: '箱包裁剪管理' },
    icon: 'el-icon-document-checked',
    children: [
      {
        path: '/bagscut/index',
        name: 'process',
        component: () => import('@/view/bagscut/index'),
        meta: { title: '箱包裁剪终端' }
      },
      {
        path: '/bagscut/process',
        name: 'process',
        component: () => import('@/view/bagscut/process'),
        meta: { title: '箱包裁剪流程' }
      }
    ]
  },
  {
    path: '/receivearea',
    name: 'receivearea',
    component: {render: (e) => e('router-view')},
    meta: { title: '收货信息' },
    icon: 'el-icon-document-checked',
    children: [
      {
        path: '/receivearea/index',
        name: 'receiveareaindex',
        component: () => import('@/view/receivearea/index'),
        meta: { title: '收货信息' }
      }
    ]
  },
  {
    path: '/tallyarea',
    name: 'tallyarea',
    component: {render: (e) => e('router-view')},
    meta: { title: '理货信息' },
    icon: 'el-icon-document-checked',
    children: [
      {
        path: '/tallyarea/index',
        name: 'tallyareaindex',
        component: () => import('@/view/tallyarea/index'),
        meta: { title: '理货信息' }
      }
    ]
  },
  {
    path: '/incomeremind',
    name: 'incomeremind',
    component: {render: (e) => e('router-view')},
    meta: { title: '物料提醒' },
    icon: 'el-icon-document-checked',
    children: [
      {
        path: '/incomeremind/index',
        name: 'incomeremindindex',
        component: () => import('@/view/incomeremind/index'),
        meta: { title: '物料提醒' }
      }
    ]
  },
  {
    path: '/cutinfo',
    name: 'cutinfo',
    component: {render: (e) => e('router-view')},
    meta: { title: '裁剪任务' },
    icon: 'el-icon-document-checked',
    children: [
      {
        path: '/cutinfo/index',
        name: 'cutinfo',
        component: () => import('@/view/cutinfo/index'),
        meta: { title: '裁剪任务' }
      }
    ]
  }
  ]
})
router.beforeEach((to, from, next) => {
  document.title = to.meta.title// 动态修改网页title
  next()
})
export default router

